$(document).ready(function(){
	var url = window.location;
	var BARCODE = cw.common.getQueryString(url,"ID");
	var STATUS = cw.common.getQueryString(url,"STATUS");
	GET_T_FIXED_ASSETS_DETAIL(BARCODE,STATUS);
});

//取得资产详细信息
var GET_T_FIXED_ASSETS_DETAIL = function(BARCODE,STATUS){
	if(""==BARCODE||null==BARCODE||undefined==BARCODE)
	{
		alert("请输入或扫描条形码!");
		return;
	}
	var url = cw.common.path + '/json?action=GET_T_FIXED_ASSETS_DETAIL_ACTION&ID='+BARCODE;
	$.post(url,{},function(data){
		if(data.success){
			var vobj=data.root.T_FIXED_ASSETS_DETAIL;
			if(vobj==null||vobj==''||vobj==undefined){
				alert("该资产不存在或已被删除");
				return;
			}
			else{
				var obj = data.root.T_FIXED_ASSETS_DETAIL.rs[0];
				cw.common.getValue('FIXED_ASSETS_NAME',obj.FIXED_ASSETS_NAME,'');
				cw.common.getValue('FIXED_ASSETS_NATURE',obj.FIXED_ASSETS_NATURE_NAME,'');
				cw.common.getValue('BRAND',obj.BRAND,'');
				cw.common.getValue('BARCODE',obj.BARCODE,'');
				cw.common.getValue('DEPARTMENT_NO_NAME',obj.GS_DEPARTMENT_NO_NAME,'');
				cw.common.getValue('STOCK_DATE',cw.common.toChar(obj.STOCK_DATE,'yyyy-mm-dd'),'');
				cw.common.getValue('STOCK_PRICE',obj.STOCK_PRICE,'');
				cw.common.getValue('USE_YEAR',obj.USE_YEAR,'');
				cw.common.getValue('WARRANTY',obj.WARRANTY,'');
				cw.common.getValue('SPECIFICATION',obj.SPECIFICATION,'');
				cw.common.getValue('SUPPLIERS_NO_NAME',obj.SUPPLIERS_NO_NAME,'');
				cw.common.getValue('FACTORY_NO',obj.FACTORY_NO,'');
				cw.common.getValue('STORED_IN',obj.STORED_IN,'');
				cw.common.getValue('WITH_MANANGER_NAME',obj.WITH_MANANGER_NAME,'');
				cw.common.getValue('REMARK',obj.REMARK,'');
				
				
				cw.common.getValue('SUPPLIERS_NO_CONTACT',obj.SUPPLIERS_NO_CONTACT,'');
				cw.common.getValue('SUPPLIERS_NO_ADDRESS',obj.SUPPLIERS_NO_ADDRESS,'');
				cw.common.getValue('SUPPLIERS_NO_ASS_PHONE',obj.SUPPLIERS_NO_ASS_PHONE,'');
				cw.common.getValue('SUPPLIERS_NO_FAX',obj.SUPPLIERS_NO_FAX,'');
				
				//cw.common.getValue('DEPARTMENT_NO_NAME',obj.DEPARTMENT_NO_NAME,'');
				cw.common.getValue('CREATE_DATE',cw.common.toChar(obj.CREATE_DATE,'yyyy-MM-dd'),'');
				//cw.common.getValue('WITH_MANANGER_NAME',obj.WITH_MANANGER_NAME,'');
				cw.common.getValue('REMARK',obj.REMARK,'');
				
				
				//-------------
				if("3"==STATUS){
					$('#spec_pan_not3').hide();
					$('#print_title').html('固定资产登记表');
					$('#ID_WITH_MANANGER_NAME').html('使用管理人');
				}else if("1"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产折旧表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;折旧原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('折旧负责人');
				}else if("2"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产维修表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;维修原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('维修负责人');
				}else if("4"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产领用表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;领用原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('领用人');
				}else if("5"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产报废表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;报废原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('报废负责人');
				}
							
			}
		}
		else{
			alert(data.errors.errmsg);
		}
	},'json');
}